Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidb-functions: add info about special start_key/end_key values #6728

Merged
merged 10 commits into from
Dec 6, 2023

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented Nov 4, 2021

What is changed, added or deleted? (Required)

sql> SELECT TABLE_NAME, REGION_ID, START_KEY, END_KEY FROM information_schema.TIKV_REGION_STATUS WHERE TABLE_NAME='stock' AND IS_INDEX=0;
+------------+-----------+--------------------------------------------------------+--------------------------------------------------------+
| TABLE_NAME | REGION_ID | START_KEY                                              | END_KEY                                                |
+------------+-----------+--------------------------------------------------------+--------------------------------------------------------+
| stock      |        74 | 7480000000000000FF4700000000000000F8                   | 7480000000000000FF475F728000000000FF029DF00000000000FA |
| stock      |        72 | 7480000000000000FF475F728000000000FF0D7ECA0000000000FA | 7480000000000000FF4900000000000000F8                   |
| stock      |        78 | 7480000000000000FF475F728000000000FF063E890000000000FA | 7480000000000000FF475F728000000000FF09E0350000000000FA |
| stock      |        76 | 7480000000000000FF475F728000000000FF029DF00000000000FA | 7480000000000000FF475F728000000000FF063E890000000000FA |
| stock      |        80 | 7480000000000000FF475F728000000000FF09E0350000000000FA | 7480000000000000FF475F728000000000FF0D7ECA0000000000FA |
+------------+-----------+--------------------------------------------------------+--------------------------------------------------------+
5 rows in set (0.0144 sec)

sql> SELECT TIDB_DECODE_KEY('7480000000000000FF4700000000000000F8');
+---------------------------------------------------------+
| TIDB_DECODE_KEY('7480000000000000FF4700000000000000F8') |
+---------------------------------------------------------+
| 7480000000000000FF4700000000000000F8                    |
+---------------------------------------------------------+
1 row in set, 1 warning (0.0013 sec)
Warning (code 1105): invalid record/index key: 748000000000000047

sql> SELECT TIDB_DECODE_KEY('7480000000000000FF475F728000000000FF0D7ECA0000000000FA');
+---------------------------------------------------------------------------+
| TIDB_DECODE_KEY('7480000000000000FF475F728000000000FF0D7ECA0000000000FA') |
+---------------------------------------------------------------------------+
| {"_tidb_rowid":884426,"table_id":"71"}                                    |
+---------------------------------------------------------------------------+
1 row in set (0.0013 sec)
sql> SELECT TABLE_NAME, REGION_ID, TIDB_DECODE_KEY(START_KEY) sk, TIDB_DECODE_KEY(END_KEY) ek FROM information_schema.TIKV_REGION_STATUS WHERE TABLE_NAME='stock' AND IS_INDEX=0 ORDER BY IF(JSON_VALID(sk),sk->'$."_tidb_rowid"',0);
+------------+-----------+----------------------------------------+----------------------------------------+
| TABLE_NAME | REGION_ID | sk                                     | ek                                     |
+------------+-----------+----------------------------------------+----------------------------------------+
| stock      |        74 | 7480000000000000FF4700000000000000F8   | {"_tidb_rowid":171504,"table_id":"71"} |
| stock      |        76 | {"_tidb_rowid":171504,"table_id":"71"} | {"_tidb_rowid":409225,"table_id":"71"} |
| stock      |        78 | {"_tidb_rowid":409225,"table_id":"71"} | {"_tidb_rowid":647221,"table_id":"71"} |
| stock      |        80 | {"_tidb_rowid":647221,"table_id":"71"} | {"_tidb_rowid":884426,"table_id":"71"} |
| stock      |        72 | {"_tidb_rowid":884426,"table_id":"71"} | 7480000000000000FF4900000000000000F8   |
+------------+-----------+----------------------------------------+----------------------------------------+
5 rows in set, 2 warnings (0.0133 sec)
Warning (code 1105): invalid record/index key: 748000000000000047
Warning (code 1105): invalid record/index key: 748000000000000049

Which TiDB version(s) do your changes apply to? (Required)

  • master (the latest development version)
  • v5.4 (TiDB 5.4 versions)
  • v5.3 (TiDB 5.3 versions)
  • v5.2 (TiDB 5.2 versions)
  • v5.1 (TiDB 5.1 versions)
  • v5.0 (TiDB 5.0 versions)
  • v4.0 (TiDB 4.0 versions)
  • v3.1 (TiDB 3.1 versions)
  • v3.0 (TiDB 3.0 versions)
  • v2.1 (TiDB 2.1 versions)

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot requested a review from TomShawn November 4, 2021 12:50
@ti-chi-bot ti-chi-bot added missing-translation-status This PR does not have translation status info. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 4, 2021
@dveeden dveeden force-pushed the tidb_decode_key__special_values branch from 89b3293 to dfc1bc0 Compare November 4, 2021 12:53
@dveeden
Copy link
Contributor Author

dveeden commented Nov 4, 2021

/cc @kolbe

@ti-chi-bot ti-chi-bot requested a review from kolbe November 4, 2021 12:53
@kolbe
Copy link
Contributor

kolbe commented Nov 4, 2021

@dveeden this is great, but maybe you could also submit a patch to tidb to make tidb_decode_key do something more sensible with these values 🙂

@dveeden
Copy link
Contributor Author

dveeden commented Nov 4, 2021

@kolbe yes, that's my plan.

Copy link
Contributor

@kolbe kolbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot
Copy link
Member

@kolbe: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

LGTM

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@shichun-0415 shichun-0415 added area/sql-infra Indicates that the Issue or PR belongs to the area of sql-infra and sql-metadata. translation/doing This PR's assignee is translating this PR. and removed missing-translation-status This PR does not have translation status info. labels Nov 5, 2021
@dveeden
Copy link
Contributor Author

dveeden commented Nov 9, 2021

/label needs-cherry-pick-release-5.2

@dveeden dveeden force-pushed the tidb_decode_key__special_values branch from 1cd358c to f4dda30 Compare January 17, 2022 09:39
@dveeden
Copy link
Contributor Author

dveeden commented Jan 17, 2022

/cc @morgo

@ti-chi-bot ti-chi-bot requested a review from morgo January 17, 2022 09:40
@dveeden
Copy link
Contributor Author

dveeden commented Jan 17, 2022

/label needs-cherry-pick-release-5.4

@ti-chi-bot ti-chi-bot added the needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. label Jan 17, 2022
@dveeden dveeden force-pushed the tidb_decode_key__special_values branch from f4dda30 to cd04e9b Compare January 17, 2022 09:42
@shichun-0415 shichun-0415 added the needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. label Jun 7, 2022
@Oreoxmt Oreoxmt requested a review from ran-huang November 29, 2023 03:40
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 30, 2023
Copy link

ti-chi-bot bot commented Nov 30, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-11-29 03:37:43.171066764 +0000 UTC m=+980291.836292958: ☑️ agreed by Oreoxmt.
  • 2023-11-30 07:24:19.746465569 +0000 UTC m=+1080288.411691765: ☑️ agreed by ran-huang.

@Oreoxmt
Copy link
Collaborator

Oreoxmt commented Dec 6, 2023

/approve

Copy link

ti-chi-bot bot commented Dec 6, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Oreoxmt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Dec 6, 2023
@Oreoxmt Oreoxmt added translation/welcome Waits for a contributor to translate this PR and create a PR to the pingcap/docs-cn repository. and removed translation/doing This PR's assignee is translating this PR. labels Dec 6, 2023
@Oreoxmt Oreoxmt removed their assignment Dec 6, 2023
@ti-chi-bot ti-chi-bot bot merged commit 7d3813d into pingcap:master Dec 6, 2023
9 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #15604.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #15605.

@qiancai qiancai added the 2024-tidb-docs-dash This issue or PR is included in the 2024 TiDB Docs Dash event. label Dec 14, 2023
@RobertCheng-956
Copy link
Contributor

/assign

@RobertCheng-956
Copy link
Contributor

/translation done

@ti-chi-bot ti-chi-bot bot added the translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. label Jan 11, 2024
@RobertCheng-956
Copy link
Contributor

/remove-translation welcome

@ti-chi-bot ti-chi-bot bot removed the translation/welcome Waits for a contributor to translate this PR and create a PR to the pingcap/docs-cn repository. label Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2024-tidb-docs-dash This issue or PR is included in the 2024 TiDB Docs Dash event. approved area/sql-infra Indicates that the Issue or PR belongs to the area of sql-infra and sql-metadata. lgtm needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR.
Development

Successfully merging this pull request may close these issues.

10 participants